{extend name="base"/}
{block name="main"}
<style>.form_message {display: block; height: 38px; line-height: 38px; text-align: left;color:#999;}
.formControls .btn {float:left;margin-right:15px;}
.clear{clear:both;}
.form-label {font-weight: bold;}</style>
<article class="cl pd-20">
	<div id="tab_demo" class="HuiTab" style="margin-bottom: 15px; position:relative;">
		<div class="tabBar clearfix">
			<span class="current">参数设置</span>
			<!--<span onclick="window.location.href='{:url('config/wxrefund')}&do=display'">微信退款设置1</span>-->
		</div>
	</div>
<form id="main_form" method="post">
	<div class="form form-horizontal" id="main">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>小程序名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" autocomplete="off" value="{$info.APP_NAME}" placeholder="请配置相关参数" class="input-text" id="APP_NAME" name="APP_NAME">
			</div>
		</div>
		<div class="row cl" style="margin-top:10px;">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>APP_ID(智能小程序)：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" autocomplete="off" value="{$info.APP_ID}" placeholder="例：12345678" class="input-text" id="APP_ID" name="APP_ID">
			</div>
		</div>
        <div class="row cl" style="margin-top:10px;">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>App Key(智能小程序)：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" autocomplete="off" value="{$info.APP_Key}" placeholder="请配置相关参数" class="input-text" id="APP_Key" name="APP_Key">
            </div>
        </div>
		<div class="row cl" style="margin-top:10px;">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>APP_SECRET(智能小程序)：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" autocomplete="off" value="{$info.APP_SECRET}" placeholder="请配置相关参数" class="input-text" id="APP_SECRET" name="APP_SECRET">
			</div>
		</div>
		<div class="row cl" style="margin-top:10px;">
			<label class="form-label col-xs-4 col-sm-3">dealId(百度收银台)：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" autocomplete="off" value="{$info.dealId}" placeholder="请配置相关参数" class="input-text" id="dealId" name="dealId">
			</div>
		</div>
		<div class="row cl" style="margin-top:10px;">
			<label class="form-label col-xs-4 col-sm-3">appKey(百度收银台)：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" autocomplete="off" value="{$info.appKey}" placeholder="请配置相关参数" class="input-text" id="appKey" name="appKey">
			</div>
		</div>
		<div class="row cl" style="margin-top:10px;">
			<label class="form-label col-xs-4 col-sm-3">平台公钥(百度收银台)：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" autocomplete="off" placeholder="请配置相关参数" class="input-text" id="app_pub" name="app_pub" style="width: 500px;height: 150px;">{$info.app_pub}</textarea>
			</div>
		</div>
		<div class="row cl" style="margin-top:10px;">
			<label class="form-label col-xs-4 col-sm-3">支付私钥(百度收银台)：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea type="text" autocomplete="off" placeholder="请配置相关参数" style="width: 500px;height: 150px;" id="pay_secret" name="pay_secret">{$info.pay_secret}</textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" onclick="addAdvertAjax()" type="button" value="   提交   " style="padding:6px 12px;">
			</div>
		</div>
	</div>
</form>
</article>
{/block}
{block name="script"}
<script type="text/javascript">
    $("#main_form").on('submit',function () {
		return false;
    });
    var flag = false;
    function addAdvertAjax() {
        if(flag){return};
//        flag = true;
        $.ajax({
            url: "{:url('baidu/config')}",
            type: 'POST',
            cache: false,
            data: new FormData($('#main_form')[0]),
            processData: false,
            contentType: false,
            dataType: 'json',
            success:function (res) {
                if (res["code"] > 0) {
                    layer.msg('提交成功!',{icon:1,time:1000},function () {
                        window.parent.location.href="{:url('baidu/config')}";
                    });
                }else{
                    layer.msg(res['message'],{icon:5,time:1000});
                }
            }
        });
    }
</script>
{/block}